/**
 *  @file Convert.h
 */
#ifndef _CONVERT_H_
#define _CONVERT_H_

#include "../common/commontypes.h"
#include "../text/CFString.h"

namespace cppflib
{

namespace convert
{

_DLLAPI int Char2Hex(wc_t c);
_DLLAPI int Char2Hex(char c);
_DLLAPI wc_t Hex2WChar(int a);
_DLLAPI char Hex2Char(int a);

_DLLAPI int ToInt32(pcwstr_t str);
_DLLAPI int ToInt32(pcwstr_t str, bool &isOverflow);
_DLLAPI i64_t ToInt64(pcwstr_t str);
_DLLAPI i64_t ToInt64(pcwstr_t str, bool &isOverflow);

_DLLAPI bool IsNaN(double v);
_DLLAPI bool IsNaN(float v);
_DLLAPI bool IsInfinity(double v);
_DLLAPI bool IsInfinity(float v);
_DLLAPI bool IsZero(double v);
_DLLAPI bool IsZero(float v);

_DLLAPI float ToFloat(pcwstr_t str);
_DLLAPI double ToDouble(pcwstr_t str);

_DLLAPI wc_t ToWUpper(wc_t c);
_DLLAPI wc_t ToWLower(wc_t c);
_DLLAPI char ToUpper(char c);
_DLLAPI char ToLower(char c);

_DLLAPI CFString ToString(int a);
_DLLAPI CFString ToString(u32_t a);
_DLLAPI CFString ToString(i64_t a);
_DLLAPI CFString ToString(u64_t a);
_DLLAPI CFString ToString(float a);
_DLLAPI CFString ToString(double a);
_DLLAPI CFString ToString(float a, pcwstr_t szFormat);
_DLLAPI CFString ToString(double a, pcwstr_t szFormat);

_DLLAPI void ToUrlEncodedString(const CFString & orgStr, CFString & retStr);
_DLLAPI void DecodeUrlEncodedString(const CFString & orgStr, int offset, int length, CFString & retStr);

}  // end of namespace convert


}  // end of namespace cppflib

#endif
